package com.dongdongqiang.admin.controller;

import com.dongdongqiang.domain.sys.SysUser;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by ZZB on 2017/9/18.
 */
@Controller
public class MainController extends SysUserLoginController {
    @RequestMapping("/")
    private String index(HttpServletRequest request){
        SysUser currentUser = getCurrentUser(request);
        if(currentUser == null){
            return "redirect:/login";
        } else{
            return "redirect:/sys/main";
        }
    }
    @RequestMapping("/sys/main")
    private String main(){
        return "/sys/main";
    }

    @RequestMapping("/admintest")
    @ResponseBody
    private String admintest(){
        return "success";
    }
}
